package com.lnking.lnkingplace.service.impl;

import com.lnking.lnkingplace.model.entity.UserStreet;
import com.lnking.lnkingplace.mapper.UserStreetMapper;
import com.lnking.lnkingplace.model.request.userStreet.UserStreetAddRequest;
import com.lnking.lnkingplace.model.request.userStreet.UserStreetUpdateRequest;
import com.lnking.lnkingplace.service.IUserStreetService;
import com.lnking.starter.mybatis.service.impl.CustomServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhangqt
 * @since 2022-08-23
 */
@Service
public class UserStreetServiceImpl extends CustomServiceImpl<UserStreetMapper, UserStreet> implements IUserStreetService {

    @Override
    public List<String> queryStreet(String userId) {

        return this.baseMapper.queryStreet(userId);
    }

    @Override
    public void add(UserStreetAddRequest params) {
        UserStreet userStreet = new UserStreet();
        BeanUtils.copyProperties(params,userStreet);
        this.baseMapper.insert(userStreet);
    }

    @Override
    public void updateUserStreet(UserStreetUpdateRequest params) {
        UserStreet userStreet = new UserStreet();
        BeanUtils.copyProperties(params,userStreet);
        this.baseMapper.updateById(userStreet);
    }
}
